home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 May / EnigmA AMIGA RUN 07 (1996)(G.R. Edizioni)(IT)[!][issue 1996-05][EARSAN CD VI].iso / rubriche / host-cont / amountns.lha / AMountains / crinkle.h < prev    next >
C/C++ Source or Header  |  1996-01-14  |  2KB  |  59 lines

  1. #ifndef CRINKLE
  2. #define CRINKLE
  3.  
  4. typedef double Height;
  5. typedef double Length;
  6.  
  7. #define START 0
  8. #define STORE 1
  9. #define NSTRIP 8
  10.  
  11. /* -------------------------------------------------------------------- */
  12. /* strip of altitudes                                                    */
  13. /* -------------------------------------------------------------------- */
  14.  
  15. typedef struct strip {
  16.     int        level;
  17.     Height    *d;                // should have 2^level + 1 points
  18. } Strip;
  19.  
  20. /* -------------------------------------------------------------------- */
  21. /* parameters for the update                                            */
  22. /* -------------------------------------------------------------------- */
  23.  
  24. typedef struct parm {
  25.     Height    mean;            // mean altitude
  26.     int        rg1;            // optional regeneration steps
  27.     int        rg2;
  28.     int        rg3;
  29.     int        cross;            // use four point average on edges rather than 2
  30.     int     force_front;    // keep front edge low
  31.     int     force_back;        // keep back edge low
  32.     Height    forceval;        // value to force to
  33.     double    mix;            // fraction of old value to include in average
  34.     double    midmix;            // same but for cross updates
  35.     double    fdim;
  36. } Parm;
  37.  
  38. /* -------------------------------------------------------------------- */
  39. /* The parameter struct for the recursive procedure                        */
  40. /* -------------------------------------------------------------------- */
  41.  
  42. typedef struct fold {
  43.     int                level;        // levels of recursion below us
  44.     Length            scale;        // scale factor for perturbations
  45.     Length            midscale;    // as above but for diagonal offsets
  46.     struct parm        *p;            // update parameters
  47.     struct strip    *s[NSTRIP];    // pointers to the pipeline strips
  48.     struct strip    *save;        // save position for STORE state
  49.     int                stop;        // level to stop recursion
  50.     int                state;        // internal stat of algorithm
  51.     struct fold        *next;        // next iteration down
  52. } Fold;
  53.  
  54. Strip *next_strip( Fold * );
  55. Fold *make_fold( Parm *, int, int, Length );
  56. void free_fold( Fold * );
  57. Length gaussian ( void );
  58. #endif
  59.